// 将一个表单的数据封装成js的Object对象
$.fn.getFormData = function() {
	var o = {};
	var a = this.serializeArray();
	$.each(a, function() {
		if (o[this.name]) {
			if (!o[this.name].push) {
				o[this.name] = [ o[this.name] ];
			}
			o[this.name].push(this.value || '');
		} else {
			o[this.name] = this.value || '';
		}
	});
	return o;
};

//禁用提交按钮并置灰
$.fn.disableSubmitBtn=function(){	
	this[0].oldClassName=this[0].className;
	this[0].className="btn-gray-2";	
	this.attr("disabled","disabled");
}

//启用提交按钮并去灰
$.fn.enableSubmitBtn=function(){
	this[0].className=this[0].oldClassName;	
	this.removeAttr("disabled");
}

//获取四舍五入保留2位小数点的金额,如:x=12,则返回12.00
function getAmountOfTwoScale(x)
{
   var f_x = parseFloat(x);
   if (isNaN(f_x))
   {
      alert('function:changeTwoDecimal->parameter error');
      return false;
   }
   var f_x = Math.round(x*100)/100;
   var s_x = f_x.toString();
   var pos_decimal = s_x.indexOf('.');
   if (pos_decimal < 0)
   {
      pos_decimal = s_x.length;
      s_x += '.';
   }
   while (s_x.length <= pos_decimal + 2)
   {
      s_x += '0';
   }
   return s_x;
}
